<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html:html>
<head>	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/sampleForm.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/me.css" />	
	<title>บันทึกใบสั่งซื้ออุปกรณ์, วัตถุดิบ (BCPurchaseOrder, BCPurchaseOrderSub)</title>
	<script type='text/javascript' src='/ittl/dwr/interface/BCProjectService.js'></script>
  	<script type='text/javascript' src='/ittl/dwr/interface/ItemLocationService.js'></script>
  	<script type='text/javascript' src='/ittl/dwr/engine.js'></script>
  	<script type='text/javascript' src='/ittl/dwr/util.js'></script>

	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/lib/jquery.js' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/lib/jquery.bgiframe.min.js1' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/lib/jquery.ajaxQueue.js1' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/lib/thickbox-compressed.js1' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/lib/jquery.autocomplete.js' ></script>
	
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/data/localdata.js' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/data/localdata2.js' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/data/codeOfBuyRequest.js' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/data/localdata31.js' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/data/localdataDepartment.js' ></script>
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/data/localdataDepartmentName.js' ></script>
	
	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/autocomplete/css/mainOLD.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/autocomplete/css/jquery.autocomplete.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/autocomplete/css/thickbox.css" />
 
 	<script type="text/javascript" src="<%= request.getContextPath() %>/stockRequest/jquery.validate.js" ></script>
 	<script type="text/javascript" src="<%= request.getContextPath() %>/stockRequest/jquery-1.4.2.min1.js" ></script>

<!-- start 
 
	<link type="text/css" href="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" />
	<link type="text/css" href="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/demos/demos.css" rel="stylesheet" />
	  	
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/jquery-1.4.2.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/external/jquery.bgiframe-2.1.1.js"></script>			
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.core.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.mouse.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.button.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.draggable.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.position.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.resizable.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.dialog.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.effects.core.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.datepicker.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/jquery-ui-1.8/development-bundle/ui/jquery.ui.autocomplete.js"></script>
			
-->
<!-- end -->

<!-- start add/remove  
	<script type="text/javascript" src='<%= request.getContextPath() %>/common/js/addremove/jquery-latest.pack.js'></script>	
-->	
	<script type="text/javascript" src='<%= request.getContextPath() %>/common/js/addremove/jquery.highlightFade.js'></script>
	<script type="text/javascript">
		
	var id = 1;	
	function addFormFieldOLD() {

		if(id<5) {											 
			id = id+1;			
			var newInput = "<tr id='r"+id+"'>"+
								"<td><input	type='text' name='itemCode"+id+"' value='' size='12' "+ 
	  								     " onblur=\"getData(document.getElementById('suggestCode"+id+"').value,"+id+")\" id=\"suggestCode"+id+"\"> "+
	  							"</td><td></td> "+
	  							"<td><input type='text' name='itemName"+id+"' value='' maxlength='200' size='40' id='itemName"+id+"' >"+					
								
								"</td><td></td>"+	
								
								"<td align='center'><LABEL id='unitName"+id+"' ></LABEL>"+					
								"	 <input	type='hidden' name='unitCode"+id+"' value='' id='unitCode"+id+"'>"+
								"</td><td></td>"+
								"<td><input	type='text'	name='qty"+id+"' value=''  size='5' id='qty"+id+"' ></td>"+
								"<td></td>"+
								"<td><input	type='text'	name='division"+id+"' value='' id='division"+id+"' ></td>"+
								"<td></td>"+								
							"</tr>";
			//alert(newInput);
			$("#inputs").append(newInput);
			$('#r' + id).highlightFade({
				speed:2000
			});			
//			$("#suggestCode"+id).autocomplete(codes, {
//				max:30,
//				minChars: 0,
//				autoFill: true,
//				mustMatch: true,
//				matchContains: false,
//				scrollHeight: 200				
//			});

						
		}else {			
			alert("คุณสามารถเพิ่มข้อมูลได้สูงสุด 4 รายการ");
		}				
	}

	var idArray = new Array();
	idArray[0] = 1;
	idArray[1] = 0;
	idArray[2] = 0;
	idArray[3] = 0;
	//idArray[4] = 0;
	var max = false;
	
	function addFormField() {
		max = true;
		for (i=0; i<idArray.length; i++) {
			if(idArray[i]==0) {
				max = false;
				idArray[i] = 1;
				id = i+1; 
				i = idArray.length;

				//alert(id);
				
				var newInput = "<tr id='r"+id+"'>"+
									"<td><a href='#' onClick='removeFormField(\"#r" + id + "\","+id+"); return false;'>"+
										"<img src=\"<%=request.getContextPath() %>/common/images/remove.png\" width=\"24\" height=\"24\" alt=\"Remove\" /></a></td>"+
									"<td><input	type='text' name='itemCode"+id+"' value='' size='12' "+ 
											     " \"> "+
										"</td><td></td> "+
										"<td><input type='text' name='itemName"+id+"' value='' maxlength='200' size='40' id='itemName"+id+"' >"+														
									"</td><td></td>"+

									
									"<td align='center'><input type='text' name='unitName"+id+"' value='' size='5' id='unitName"+id+"' >"+																																
									"	 <input	type='hidden' name='unitCode"+id+"' value='' id='unitCode"+id+"'>"+
									"</td><td></td>"+

									
									"<td><input	type='text'	name='qty"+id+"' value=''  size='5' id='qty"+id+"' ></td><td></td>"+
									"<td><input	type='text'	name='division"+id+"' value='' id='division"+id+"' ></td>"+
									"<td></td>"+
								"</tr>";


				//alert(newInput);
				$("#inputs").append(newInput); 
				$('#r' + id).highlightFade({
					speed:2000
				});			
				$("#suggestCode"+id).autocomplete(codes, {
					max:30,
					minChars: 0,
					autoFill: true,
					mustMatch: true,
					matchContains: false,
					scrollHeight: 200				
				});

				$("#suggestCode"+id+id).autocomplete(itemsName, {
					minChars: 0,
					width: 400,
					max:50,
					mustMatch: true,
					matchContains: true,
					autoFill: false,
					formatItem: function(row, i, max) {
						return row.code + ": [" + row.name + "]";
					},
					formatMatch: function(row, i, max) {
						return row.code + ": [" + row.name + "]";
					},
					formatResult: function(row) {
						return row.code;
					}
				});
								
			}
		}
						
		if(max==true) {											 	
			alert("คุณสามารถเพิ่มข้อมูลได้สูงสุด 4 รายการ");
		}				
	}
	
	function removeFormField(rid, id) {
		var count = 0;
		for (i=0; i<idArray.length; i++) {
			if(idArray[i]>0) {
				count++;
			}
		}		
		if(count>1) {
			$(rid).remove();
			idArray[id-1] = 0;
		}else {
			alert("กรุณาบันทึกข้อมูลอย่างน้อย 1 รายการ");
		}
		
	}
		
	</script>
<!-- end add/remove  -->

<style type="text/css">
#form1 label.error {
	font-size: 1.0em;
	color: red;
}
</style>
 	
<script language="JavaScript">
 
function compareBuga() {
	return "buga22";
}

$.validator.addMethod("buga", function(value) {
	return value == compareBuga();
}, 'Please enter "buga"!');

$(document).ready(function() {
	 
	//$("#datepicker").datepicker();
	
/* 
	$("#dialog-confirm").dialog({
		autoOpen: true,
		resizable: false,
		height:140,
		modal: true,
		buttons: {
			'Delete all items': function() {
				$(this).dialog('close');
			},
			Cancel: function() {
				$(this).dialog('close');
			}
		}
	});

*/	
	
	$("#form1").validate({
		
			
		submitHandler: function() {
			alert("txt1="+document.getElementById("txt1").value);
			alert("submitted!22");
			//$('#dialog-confirm').dialog('open');
			form.submit();
		},
				
		rules: {
			txt1: "required",
			docDate: "required",
			iTTL_deptPay: "required",
			projectCode: "required",
			itemCode1: "required",
			itemCode2: "required",
			itemCode3: "required",
			itemCode4: "required",
			itemCode5: "required",
			itemName1: "required",
			itemName2: "required",
			itemName3: "required",
			itemName4: "required",
			itemName5: "required",
			unitName1: "required",
			unitName2: "required",
			unitName3: "required",
			unitName4: "required",													
			shelfCode1: "required",
			shelfCode2: "required",
			shelfCode3: "required",
			shelfCode4: "required",
			shelfCode5: "required",		
			qty1: {
				required: 	true,
				number:		true
			},
			qty2: {
				required: 	true,
				number:		true
			},
			qty3: {
				required: 	true,
				number:		true
			},
			qty4: {
				required: 	true,
				number:		true
			},
			qty5: {
				required: 	true,
				number:		true
			}						
		},
		messages: {
			txt1: "*",
			docDate: "*",
			iTTL_deptPay: "*",
			projectCode: "*",
			itemCode1: "*",
			itemCode2: "*",				
			itemCode3: "*",
			itemCode4: "*",
			itemCode5: "*",
			itemName1: "*",
			itemName2: "*",
			itemName3: "*",
			itemName4: "*",
			itemName5: "*",
			shelfCode1: "*",
			shelfCode2: "*",
			shelfCode3: "*",
			shelfCode4: "*",
			shelfCode5: "*",
			unitName1: "*",
			unitName2: "*",
			unitName3: "*",
			unitName4: "*",									
			qty1: "*",
			qty2: "*",
			qty3: "*",
			qty4: "*",
			qty5: "*"	
		},

		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			//alert("errorPlacement");			
			if ( element.is(":radio") ) {
				alert("radio");
				error.appendTo( element.parent().next().next() );
			}else if ( element.is(":checkbox") ) {
				alert("checkbox");
				error.appendTo ( element.next() );
			}else {
				/*alert(element("#itemCode1"));
				if(element.is("#itemCode1")) {
					error.appendTo( "#qty1-error" );
				}else {
					error.appendTo( element.parent().next() );	
				}*/
				//error.insertAfter('#qty1-error');
				error.appendTo( element.parent().next() );
			}
		}		
	});
	

	$("#suggest1").focus().autocomplete(cities);
	
	$("#suggestProject").autocomplete(projects, {		
		max:30,
		minChars: 0,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 200
	});

	
	$("#departCode").autocomplete(departments, {		
		max:30,
		minChars: 0,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 200
	});
			
	$("#suggestDeptPay").autocomplete(departments, {		
		max:30,
		minChars: 0,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 200
	});
			
	$("#suggestCode1").autocomplete(codes, {
		max:30,
		minChars: 0,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 200				
	});
	
	$("#suggestCode2").autocomplete(codes, {
		max:30,
		minChars: 0,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 200
	});
	
	$("#suggestCode3").autocomplete(codes, {
		max:30,
		minChars: 0,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 200
	});
	
	$("#suggestCode4").autocomplete(codes, {
		max:30,
		minChars: 0,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 200
	});
	$("#suggestCode5").autocomplete(codes, {
		max:30,
		minChars: 0,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 200
	});
	
	$("#suggest11").autocomplete(cities, {
		matchContains: true,
		minChars: 0
	});

    $("#itemName5").autocomplete(cities, { scroll: true } );

	$("#suggest4").autocomplete(emails, {
		minChars: 0,
		
		matchContains: true,
		autoFill: false,
		formatItem: function(row, i, max) {
			return i + "/" + max + ": \"" + row.name + "\" [" + row.to + "]";
		},
		formatMatch: function(row, i, max) {
			return row.name + " " + row.to;
		},
		formatResult: function(row) {
			return row.to;
		}
	});

	$("#division1OLD").autocomplete(departmentsName, {
		minChars: 0,
		mustMatch: true,
		matchContains: true,
		autoFill: false,
		formatItem: function(row, i, max) {
			return row.code + ": [" + row.name + "]";
		},
		formatMatch: function(row, i, max) {
			return row.code + ": [" + row.name + "]";
		},
		formatResult: function(row) {
			return row.name;
		}
	});	

	$("#suggestCode11").autocomplete(itemsName, {
		minChars: 0,
		width: 400,
		max:50,
		mustMatch: true,
		matchContains: true,
		autoFill: false,
		formatItem: function(row, i, max) {
			return row.code + ": [" + row.name + "]";
		},
		formatMatch: function(row, i, max) {
			return row.code + ": [" + row.name + "]";
		},
		formatResult: function(row) {
			return row.code;
		}
	});
			
});

</script>  

<!--  ส่วนที่ 2 -->
<script language="JavaScript">
var inputNo;
var itemName = "";
var code;
var itemName;
var whCode;
var shelfCode;
var shelfName;

function getData(var1,x) {	
	inputNo = x;
	ItemLocationService.getData( var1, loadinfo );	  
}

<!--  ส่วนที่ 3 -->
function loadinfo(data)
{
	code 	  = data.code;
	itemName  = data.name1;
	whCode 	  = data.whCode;
	shelfCode = data.shelfCode;
	shelfName = data.shelfName;
	unitCode = data.unitCode;
	unitName = data.unitName;

	ittl_row = data.ittl_row;
	ittl_shelf = data.ittl_shelf;
	
	switch(inputNo) {
	case 1:	dwr.util.setValue("itemCode1", code);
			dwr.util.setValue("itemName1", itemName);
			dwr.util.setValue("whCode1", whCode);
			dwr.util.setValue("whCode11", whCode);
			dwr.util.setValue("unitCode1", unitCode);
			dwr.util.setValue("unitName1", unitName);
			//redirectN(0, document.getElementById('shCode1'));
			
			dwr.util.setValue("ittl_row1", ittl_row);
			dwr.util.setValue("ittl_shelf1", ittl_shelf);
								
			break;
	case 2:	dwr.util.setValue("itemCode2", code);
			dwr.util.setValue("itemName2", itemName);
			dwr.util.setValue("whCode2", whCode);			
			dwr.util.setValue("unitCode2", unitCode);
			dwr.util.setValue("unitName2", unitName);
			//redirectN(0, document.getElementById('shCode2'));
			
			dwr.util.setValue("ittl_row2", ittl_row);
			dwr.util.setValue("ittl_shelf2", ittl_shelf);
									
			break;
	case 3:	dwr.util.setValue("itemCode3", code);
			dwr.util.setValue("itemName3", itemName);
			dwr.util.setValue("whCode3", whCode);			
			dwr.util.setValue("unitCode3", unitCode);
			dwr.util.setValue("unitName3", unitName);
			//redirectN(0, document.getElementById('shCode3'));
			
			dwr.util.setValue("ittl_row3", ittl_row);
			dwr.util.setValue("ittl_shelf3", ittl_shelf);
									
			break;
	case 4:	dwr.util.setValue("itemCode4", code);
			dwr.util.setValue("itemName4", itemName);
			dwr.util.setValue("whCode4", whCode);			
			dwr.util.setValue("unitCode4", unitCode);
			dwr.util.setValue("unitName4", unitName);
			//redirectN(0, document.getElementById('shCode4'));
			
			dwr.util.setValue("ittl_row4", ittl_row);
			dwr.util.setValue("ittl_shelf4", ittl_shelf);						
			break;
	case 5:	dwr.util.setValue("itemCode5", code);
			dwr.util.setValue("itemName5", itemName);
			dwr.util.setValue("whCode5", whCode);			
			dwr.util.setValue("unitCode5", unitCode);
			dwr.util.setValue("unitName5", unitName);
			//redirectN(0, document.getElementById('shCode5'));//ใช้ document.form1.shelfCode5 จะทำงานได้บน IE แต่ไม่ไได้บน FF

			dwr.util.setValue("ittl_row5", ittl_row);
			dwr.util.setValue("ittl_shelf5", ittl_shelf);			
			break;
	}		
}

function redirectN(x, tempN){
	
	var groupsN=5;//document.form1.shelfCode1.options.length
	var groupN=new Array(groupsN);
	for (i=0; i<groupsN; i++)
		groupN[i]=new Array();

	//var tempN=document.form1.shelfCode1;	
	//alert("tempN.options.length-1 = "+(tempN.options.length-1));
	for (m=tempN.options.length-1;m>=0;m--) {
		//alert(tempN.options[m]);
		tempN.options[m]=null;
	}
	
	if(shelfName != null) {
		for (i=0; i<shelfName.length; i++) {
			groupN[0][i]=new Option(shelfName[i], shelfCode[i]);
		}
					
		for (i=0;i<groupN[x].length;i++){
			text = groupN[x][i].value+":"+groupN[x][i].text;
			tempN.options[i]=new Option(text,groupN[x][i].value);
		}
		tempN.options[0].selected=true;
	}
}
</script>
<!--  ส่วนที่ 2 -->
<script language="JavaScript">

function getProject() {
	//alert("bcproject"+form1.projectCode.value); ใช้ใน ff ไม่ผ่าน			
	BCProjectService.getProject( document.getElementById("suggestProject").value, loadinfoProject );			  
}

<!--  ส่วนที่ 3 -->
function loadinfoProject(project){		
	//dwr.util.setValue("projectCode", project.name);
	dwr.util.setValue("projectName", project.name);			     
}
</script>	

<script type="text/javascript">
function alertValue() {
	alert(document.getElementById('htmlElementTest').value)
}
</script>

	<link type="text/css" href="<%= request.getContextPath() %>/css/datepicker/css/ui.all.css" rel="stylesheet" /> 
	
	<script type="text/javascript" src="<%= request.getContextPath() %>/css/datepicker/lib/jquery-ui-1.5.3.min.js"></script>
	

	<script type="text/javascript">
		$(document).ready(function(){
    			$("#docDate").datepicker({ altField: 'input#docDate', altFormat: 'yy-mm-dd' });
  		});
	</script>

<script type="text/javascript">
	var sumOfLineItemAmount = new Array();
	var sumOfAmount = 0;
	var qty = 0;
	var price = 0;

	var qtyArray = new Array();
	for(var i=1; i<=15; i++) {
		qtyArray[i]=0;
		sumOfLineItemAmount[i] = 0;
	}
	
function calLineItem(id) {

	sumOfAmount -= sumOfLineItemAmount[id];	 
	qty = document.getElementById('qty'+id).value;
	price = document.getElementById('price'+id).value;
	
	sumOfLineItemAmount[id] = qty*price;
	document.getElementById('amount'+id).value = sumOfLineItemAmount[id];

//	alert(qtyArray[id]);
//	if (qtyArray[id]!= qty) {
//		sumOfItemAmount = sumOfItemAmount-qtyArray[id]*price;
//		qtyArray[id]= qty;			
//	}
	sumOfAmount += sumOfLineItemAmount[id];

	var discountAmount = document.getElementById('discountAmount').value;
	var vat = parseFloat(((sumOfAmount-discountAmount)*0.07).toFixed(2));
	document.getElementById('taxAmount').value = vat;
	document.getElementById('sumOfItemAmount').value = sumOfAmount;
	document.getElementById('totalAmount').value = parseFloat(sumOfAmount+vat).toFixed(2);
	document.getElementById('netAmount').value = parseFloat(sumOfAmount+vat).toFixed(2);	
}

function calDiscount() {
	var discountAmount = document.getElementById('discountAmount').value;
	var vat = parseFloat(((sumOfAmount-discountAmount)*0.07).toFixed(2));
	document.getElementById('taxAmount').value = vat;
	document.getElementById('totalAmount').value = parseFloat(sumOfAmount+vat-discountAmount).toFixed(2);
	document.getElementById('netAmount').value = parseFloat(sumOfAmount+vat-discountAmount).toFixed(2);		 	  
}
</script>
</head>

<body>
			
	<div style="background: #ffffff;">
	<p align="center" id="titleIssueType">บันทึกใบสั่งซื้ออุปกรณ์, วัตถุดิบ </p>
	
	<html:form action="/purchaseOrder.do?mode=add" styleId="form1"  >	        
                
	<div id="userPw01">
	<fieldset>
		<legend><b>ข้อมูลใบสั่งซื้ออุปกรณ์, วัตถุดิบ</b></legend>
		   <center> 
		   <table border="0" >
			<tr>
				<td width="160"><label> เลขที่ใบสั่งซื้อ </label></td>
				<td width="140"><input type="text" name="docNo" value="${docNo}" readonly="readonly" id="docNo" ></td>
				<td ></td>				
			</tr>
			<tr>
				<td ><label> วันที่ออกเอกสาร</label></td>
				<td ><input type="text" name="docDate" id="docDate" maxlength="10"></td>
				<td ></td>					
			</tr>							
			<tr>
				<td><label>แผนก</label></td>
				<td><input type="text" name="departCode" maxlength="3" value="${departCode }" id="departCode" ></td>
				<td ></td>			
			</tr>
 			<tr>
 				<td><label>รหัสเจ้าหนี้</label></td>
 				<td><input type="text" name="apCode" value="${apCode }" id="suggestAp" readonly="readonly">
 				<td ></td>				 				 				
 			</tr>			
 			<tr>
 				<td><label>ผู้บันทึกข้อมูล</label></td>
 				<td><input type="text" name="creatorCode" value="${userName}" readonly="readonly"></td>
 				<td ></td>	
 			</tr>
 			<tr>
 				<td><label>โครงการ</label></td>
 				<td><input type="text" name="projectCode" value="" ></td>
 				<td ></td>	
 			</tr>
 			<tr>
 				<td><label>รหัสสกุลเงิน</label></td>
 				<td><select name="currencyCode">
 						<option value="BATH" selected="selected">บาท</option>
 						<option value="EUR">ยูโร</option>
 						<option value="JPY">เยนส์</option>
 						<option value="USD">ดอลล่าร์</option>
 						<option value="YEN">เยนส์</option>
 					</select> </td>
 				<td ></td>	
 			</tr> 			 			
 			<tr>
 				<td><label>ยอดรวมมูลค่าสินค้า</label></td>
 				<td><input type="text" name="sumOfItemAmount" value="" id="sumOfItemAmount"></td>
 				<td ></td>	
 			</tr>
 			<tr>
 				<td><label>ส่วนลดบาท</label></td>
 				<td><input type="text" name="discountAmount" value="" id="discountAmount" onchange="calDiscount()"></td>
 				<td ></td>	
 			</tr> 			
 			<tr>
 				<td><label>ภาษีมูลค่าเพิ่ม</label></td>
 				<td><input type="text" name="taxAmount" value="" id="taxAmount"></td>
 				<td ></td>	
 			</tr> 				 	
 			<tr>
 				<td><label>มูลค่ารวมภาษี</label></td>
 				<td><input type="text" name="totalAmount" value="" id="totalAmount"></td>
 				<td ></td>	
 			</tr> 					
 			<tr>
 				<td><label>มูลค่าสุทธิ</label></td>
 				<td><input type="text" name="netAmount" value="" id="netAmount"></td>
 				<td ></td>	
 			</tr> 			 				 							
		</table>
		</center>
     </fieldset></div>
    <div id="items"> 
     <fieldset>
     	<legend><b>รายการอุปกรณ์, วัตถุดิบ</b></legend>     	
     	     	
     	<p><a href="#" onClick="addFormField(); return false;">
     			<img src="<%=request.getContextPath() %>/common/images/add.png" width="24" height="24" alt="Add" />
     		</a>     			   
     	</p>
     	
     		<input type="hidden" id="id" value="0">
     	<center>	     		          	
		<table border="1" >
			<thead>
				<tr id="rHead">
					<th width="24"></th>
				  <th width="100" align="center">รหัสสินค้า</th>
				  <th width="10">&nbsp;</th>
				  <th width="270" align="center">ชื่อรายการ</th>
				  <th width="10">&nbsp;</th>				

				  <th width="70"  align="center">หน่วยนับ</th>
				  <th width="10">&nbsp;</th>
				  <th width="60"  align="center">จำนวน</th>
				  <th width="60"  align="center">ราคาซื้อ</th>
				  <th width="10">&nbsp;</th>				  
				  <th width="60"  align="center">จำนวนเงิน</th>
				  <th width="10">&nbsp;</th>				  
				  <th width="60"  align="center">หน่วยที่เบิก</th>
				  <th width="10">&nbsp;</th>				
				</tr>						
			</thead>
			
			<tbody id="inputs" >
<c:if test="${!empty fullForm.itemCode1}"> 			
				<tr id="r1">
					<td><a href='#' onClick='removeFormField("#r1",1); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode1" value="${fullForm.itemCode1 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName1" value="${fullForm.itemName1 }" maxlength="200" size="40" id="itemName1">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName1" value="${fullForm.unitName1 }" size="5" id="unitName1" >					
						<input	type="hidden" name="unitCode1" value="${fullForm.unitCode1 }" id="unitCode1">
					</td><td></td>
					<td><input	type="text"	name="qty1" value="${fullForm.qty1 }"  size="5" id="qty1" readonly="readonly" ></td>
					<td><input	type="text"	name="price1" value="" size="5" id="price1" onchange="calLineItem(1);" ></td>
					<td></td>
					<td><input	type="text"	name="amount1" value="" size="5" id="amount1" ></td>
					<td></td>
					<td>${fullForm.stkReqNo1 }<input	type="hidden" name="stkReqNo1" value="${fullForm.stkReqNo1}" id="stkReqNo1"></td>
					<td><input	type="hidden" name="confirmNo1" value="${fullForm.confirmNo1}" id="confirmNo1"></td>					
				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode2}">
				<tr id="r2">
					<td><a href='#' onClick='removeFormField("#r2",2); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode2" value="${fullForm.itemCode2 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName2" value="${fullForm.itemName2 }" maxlength="200" size="40" id="itemName2">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName2" value="${fullForm.unitName2 }" size="5" id="unitName2" >					
						<input	type="hidden" name="unitCode2" value="${fullForm.unitCode2 }" id="unitCode2">
					</td><td></td>
					<td><input	type="text"	name="qty2" value="${fullForm.qty2 }"  size="5" id="qty2" readonly="readonly"></td>
					<td><input	type="text"	name="price2" value="" size="5" id="price2"  onchange="calLineItem(2);"></td>
					<td></td>
					<td><input	type="text"	name="amount2" value="" size="5" id="amount2" ></td>
					<td></td>
					<td>${fullForm.stkReqNo2 }<input	type="hidden" name="stkReqNo2" value="${fullForm.stkReqNo2}" id="stkReqNo2"></td>
					<td><input	type="hidden" name="confirmNo2" value="${fullForm.confirmNo2}" id="confirmNo2"></td>					
				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode3}">				
				<tr id="r3">
					<td><a href='#' onClick='removeFormField("#r3",3); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode3" value="${fullForm.itemCode3 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName3" value="${fullForm.itemName3 }" maxlength="200" size="40" id="itemName3">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName3" value="${fullForm.unitName3 }" size="5" id="unitName3" >					
						<input	type="hidden" name="unitCode3" value="${fullForm.unitCode3 }" id="unitCode3">
					</td><td></td>
					<td><input	type="text"	name="qty3" value="${fullForm.qty3 }"  size="5" id="qty3" readonly="readonly"></td>
					<td><input	type="text"	name="price3" value="" size="5" id="price3"  onchange="calLineItem(3);"></td>
					<td></td>
					<td><input	type="text"	name="amount3" value="" size="5" id="amount3" ></td>
					<td></td>
					<td>${fullForm.stkReqNo3 }<input	type="hidden" name="stkReqNo3" value="${fullForm.stkReqNo3}" id="stkReqNo3"></td>
					<td><input	type="hidden" name="confirmNo3" value="${fullForm.confirmNo3}" id="confirmNo3"></td>					
				</tr>				
</c:if>
<c:if test="${!empty fullForm.itemCode4}">
				<tr id="r4">
					<td><a href='#' onClick='removeFormField("#r4",4); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode4" value="${fullForm.itemCode4 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName4" value="${fullForm.itemName4 }" maxlength="200" size="40" id="itemName4">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName4" value="${fullForm.unitName4 }" size="5" id="unitName4" >					
						<input	type="hidden" name="unitCode4" value="${fullForm.unitCode4 }" id="unitCode4">
					</td><td></td>
					<td><input	type="text"	name="qty4" value="${fullForm.qty4 }"  size="5" id="qty4" readonly="readonly"></td>
					<td><input	type="text"	name="price4" value="" size="5" id="price4"  onchange="calLineItem(4);"></td>
					<td></td>
					<td><input	type="text"	name="amount4" value="" size="5" id="amount4" ></td>
					<td></td>
					<td>${fullForm.stkReqNo4 }<input	type="hidden" name="stkReqNo4" value="${fullForm.stkReqNo4}" id="stkReqNo4"></td>
					<td><input	type="hidden" name="confirmNo4" value="${fullForm.confirmNo4}" id="confirmNo4"></td>					
				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode5}">
				<tr id="r5">
					<td><a href='#' onClick='removeFormField("#r5",5); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode5" value="${fullForm.itemCode5 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName5" value="${fullForm.itemName5 }" maxlength="200" size="40" id="itemName5">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName5" value="${fullForm.unitName5 }" size="5" id="unitName5" >					
						<input	type="hidden" name="unitCode5" value="${fullForm.unitCode5 }" id="unitCode5">
					</td><td></td>
					<td><input	type="text"	name="qty5" value="${fullForm.qty5 }"  size="5" id="qty5" readonly="readonly"></td>
					<td><input	type="text"	name="price5" value="" size="5" id="price5"  onchange="calLineItem(5);"></td>
					<td></td>
					<td><input	type="text"	name="amount5" value="" size="5" id="amount5" ></td>
					<td></td>
					<td>${fullForm.stkReqNo5 }<input	type="hidden" name="stkReqNo5" value="${fullForm.stkReqNo5}" id="stkReqNo5"></td>
					<td><input	type="hidden" name="confirmNo5" value="${fullForm.confirmNo5}" id="confirmNo5"></td>					
				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode6}">				
				<tr id="r6">
					<td><a href='#' onClick='removeFormField("#r6",6); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode6" value="${fullForm.itemCode6 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName6" value="${fullForm.itemName6 }" maxlength="200" size="40" id="itemName6">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName6" value="${fullForm.unitName6 }" size="5" id="unitName6" >					
						<input	type="hidden" name="unitCode6" value="${fullForm.unitCode6 }" id="unitCode6">
					</td><td></td>
					<td><input	type="text"	name="qty6" value="${fullForm.qty6 }"  size="5" id="qty6" readonly="readonly"></td>
					<td><input	type="text"	name="price6" value="" size="5" id="price6"  onchange="calLineItem(6);"></td>
					<td></td>
					<td><input	type="text"	name="amount6" value="" size="5" id="amount6" ></td>
					<td></td>
					<td>${fullForm.stkReqNo6 }<input	type="hidden" name="stkReqNo6" value="${fullForm.stkReqNo6}" id="stkReqNo6"></td>
					<td><input	type="hidden" name="confirmNo6" value="${fullForm.confirmNo6}" id="confirmNo6"></td>					

				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode7}">				
				<tr id="r7">
					<td><a href='#' onClick='removeFormField("#r7",7); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode7" value="${fullForm.itemCode7 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName7" value="${fullForm.itemName7 }" maxlength="200" size="40" id="itemName7">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName7" value="${fullForm.unitName7 }" size="5" id="unitName7" >					
						<input	type="hidden" name="unitCode7" value="${fullForm.unitCode7 }" id="unitCode7">
					</td><td></td>
					<td><input	type="text"	name="qty7" value="${fullForm.qty7 }"  size="5" id="qty7" readonly="readonly"></td>
					<td><input	type="text"	name="price7" value="" size="5" id="price7"  onchange="calLineItem(7);"></td>
					<td></td>
					<td><input	type="text"	name="amount7" value="" size="5" id="amount7" ></td>
					<td></td>
					<td>${fullForm.stkReqNo7 }<input	type="hidden" name="stkReqNo7" value="${fullForm.stkReqNo7}" id="stkReqNo7"></td>
					<td><input	type="hidden" name="confirmNo7" value="${fullForm.confirmNo7}" id="confirmNo7"></td>					

				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode8}">				
				<tr id="r8">
					<td><a href='#' onClick='removeFormField("#r8",8); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode8" value="${fullForm.itemCode8 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName8" value="${fullForm.itemName8 }" maxlength="200" size="40" id="itemName8">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName8" value="${fullForm.unitName8 }" size="5" id="unitName8" >					
						<input	type="hidden" name="unitCode8" value="${fullForm.unitCode8 }" id="unitCode8">
					</td><td></td>
					<td><input	type="text"	name="qty8" value="${fullForm.qty8 }"  size="5" id="qty8" readonly="readonly"></td>
					<td><input	type="text"	name="price8" value="" size="5" id="price8"  onchange="calLineItem(8);" ></td>
					<td></td>
					<td><input	type="text"	name="amount8" value="" size="5" id="amount8" ></td>
					<td></td>
					<td>${fullForm.stkReqNo8 }<input	type="hidden" name="stkReqNo8" value="${fullForm.stkReqNo8}" id="stkReqNo8"></td>
					<td><input	type="hidden" name="confirmNo8" value="${fullForm.confirmNo8}" id="confirmNo8"></td>					

				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode9}">				
				<tr id="r9">
					<td><a href='#' onClick='removeFormField("#r9",9); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode9" value="${fullForm.itemCode9 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName9" value="${fullForm.itemName9 }" maxlength="200" size="40" id="itemName9">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName9" value="${fullForm.unitName9 }" size="5" id="unitName9" >					
						<input	type="hidden" name="unitCode9" value="${fullForm.unitCode9 }" id="unitCode9" >
					</td><td></td>
					<td><input	type="text"	name="qty9" value="${fullForm.qty9 }"  size="5" id="qty9" readonly="readonly"></td>
					<td><input	type="text"	name="price9" value="" size="5" id="price9" onchange="calLineItem(9);" ></td>
					<td></td>
					<td><input	type="text"	name="amount9" value="" size="5" id="amount9" ></td>
					<td></td>
					<td>${fullForm.stkReqNo9 }<input	type="hidden" name="stkReqNo9" value="${fullForm.stkReqNo9}" id="stkReqNo9"></td>
					<td><input	type="hidden" name="confirmNo9" value="${fullForm.confirmNo9}" id="confirmNo9"></td>					

				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode10}">				
				<tr id="r10">
					<td><a href='#' onClick='removeFormField("#r10",10); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode10" value="${fullForm.itemCode10 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName10" value="${fullForm.itemName10 }" maxlength="200" size="40" id="itemName10">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName10" value="${fullForm.unitName10 }" size="5" id="unitName10" >					
						<input	type="hidden" name="unitCode10" value="${fullForm.unitCode10 }" id="unitCode10">
					</td><td></td>
					<td><input	type="text"	name="qty10" value="${fullForm.qty10 }"  size="5" id="qty10" readonly="readonly"></td>
					<td><input	type="text"	name="price10" value="" size="5" id="price10"  onchange="calLineItem(10);"></td>
					<td></td>
					<td><input	type="text"	name="amount10" value="" size="5" id="amount10" ></td>
					<td></td>
					<td>${fullForm.stkReqNo10 }<input	type="hidden" name="stkReqNo10" value="${fullForm.stkReqNo10}" id="stkReqNo10"></td>
					<td><input	type="hidden" name="confirmNo10" value="${fullForm.confirmNo10}" id="confirmNo10"></td>

				</tr>		
</c:if>
<c:if test="${!empty fullForm.itemCode11}">				
				<tr id="r11">
					<td><a href='#' onClick='removeFormField("#r11",11); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode11" value="${fullForm.itemCode11 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName11" value="${fullForm.itemName11 }" maxlength="200" size="40" id="itemName11">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName11" value="${fullForm.unitName11 }" size="5" id="unitName11" >					
						<input	type="hidden" name="unitCode11" value="${fullForm.unitCode11 }" id="unitCode11">
					</td><td></td>
					<td><input	type="text"	name="qty11" value="${fullForm.qty11 }"  size="5" id="qty11" readonly="readonly"></td>
					<td><input	type="text"	name="price11" value="" size="5" id="price11"  onchange="calLineItem(11);" ></td>
					<td></td>
					<td><input	type="text"	name="amount11" value="" size="5" id="amount11" ></td>
					<td></td>
					<td>${fullForm.stkReqNo11 }<input	type="hidden" name="stkReqNo11" value="${fullForm.stkReqNo11}" id="stkReqNo11"></td>
					<td><input	type="hidden" name="confirmNo11" value="${fullForm.confirmNo11}" id="confirmNo11"></td>					

				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode12}">				
				<tr id="r12">
					<td><a href='#' onClick='removeFormField("#r12",12); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode12" value="${fullForm.itemCode12 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName12" value="${fullForm.itemName12 }" maxlength="200" size="40" id="itemName12">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName12" value="${fullForm.unitName12 }" size="5" id="unitName12" >					
						<input	type="hidden" name="unitCode12" value="${fullForm.unitCode12 }" id="unitCode12">
					</td><td></td>
					<td><input	type="text"	name="qty12" value="${fullForm.qty12 }"  size="5" id="qty12" readonly="readonly" ></td>
					<td><input	type="text"	name="price12" value="" size="5" id="price12"  onchange="calLineItem(12);"></td>
					<td></td>
					<td><input	type="text"	name="amount12" value="" size="5" id="amount12" ></td>
					<td></td>
					<td>${fullForm.stkReqNo12 }<input	type="hidden" name="stkReqNo12" value="${fullForm.stkReqNo12}" id="stkReqNo12"></td>
					<td><input	type="hidden" name="confirmNo12" value="${fullForm.confirmNo12}" id="confirmNo12"></td>

				</tr>				
</c:if>
<c:if test="${!empty fullForm.itemCode13}">				
				<tr id="r13">
					<td><a href='#' onClick='removeFormField("#r13",13); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode13" value="${fullForm.itemCode13 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName13" value="${fullForm.itemName13 }" maxlength="200" size="40" id="itemName13">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName13" value="${fullForm.unitName13 }" size="5" id="unitName13" >					
						<input	type="hidden" name="unitCode13" value="${fullForm.unitCode13 }" id="unitCode13">
					</td><td></td>
					<td><input	type="text"	name="qty13" value="${fullForm.qty13 }"  size="5" id="qty13" readonly="readonly"></td>
					<td><input	type="text"	name="price13" value="" size="5" id="price13"  onchange="calLineItem(13);"></td>
					<td></td>
					<td><input	type="text"	name="amount13" value="" size="5" id="amount13" ></td>
					<td></td>
					<td>${fullForm.stkReqNo13 }<input	type="hidden" name="stkReqNo13" value="${fullForm.stkReqNo13}" id="stkReqNo13"></td>
					<td><input	type="hidden" name="confirmNo13" value="${fullForm.confirmNo13}" id="confirmNo13"></td>

				</tr>		
</c:if>
<c:if test="${!empty fullForm.itemCode14}">				
				<tr id="r14">
					<td><a href='#' onClick='removeFormField("#r14",14); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode14" value="${fullForm.itemCode14 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName14" value="${fullForm.itemName14 }" maxlength="200" size="40" id="itemName14">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName14" value="${fullForm.unitName14 }" size="5" id="unitName14" >					
						<input	type="hidden" name="unitCode14" value="${fullForm.unitCode14 }" id="unitCode14">
					</td><td></td>
					<td><input	type="text"	name="qty14" value="${fullForm.qty14 }"  size="5" id="qty14" readonly="readonly"></td>
					<td><input	type="text"	name="price14" value="" size="5" id="price14"  onchange="calLineItem(14);"></td>
					<td></td>
					<td><input	type="text"	name="amount14" value="" size="5" id="amount14" ></td>
					<td></td>
					<td>${fullForm.stkReqNo14 }<input	type="hidden" name="stkReqNo14" value="${fullForm.stkReqNo14}" id="stkReqNo14"></td>
					<td><input	type="hidden" name="confirmNo14" value="${fullForm.confirmNo14}" id="confirmNo14"></td>

				</tr>
</c:if>
<c:if test="${!empty fullForm.itemCode15}">								
				<tr id="r15">
					<td><a href='#' onClick='removeFormField("#r15",15); return false;'>
						<img src="<%=request.getContextPath() %>/common/images/remove.png" width="24" height="24" alt="Remove" /></a>
					</td>								
				  	<td><input 	type="text" name="itemCode15" value="${fullForm.itemCode15 }" size="12" readonly="readonly">			  		
				  	</td><td></td>
					<td><input 	type="text" name="itemName15" value="${fullForm.itemName15 }" maxlength="200" size="40" id="itemName15">					
					</td><td></td>
										
					<td align="center"><input	type="text"	name="unitName15" value="${fullForm.unitName15 }" size="5" id="unitName15" >					
						<input	type="hidden" name="unitCode15" value="${fullForm.unitCode15 }" id="unitCode15">
					</td><td></td>
					<td><input	type="text"	name="qty15" value="${fullForm.qty15 }"  size="5" id="qty15" readonly="readonly"></td>
					<td><input	type="text"	name="price15" value="" size="5" id="price15"  onchange="calLineItem(15);" ></td>
					<td></td>
					<td><input	type="text"	name="amount15" value="" size="5" id="amount15" ></td>
					<td></td>
					<td>${fullForm.stkReqNo15 }<input	type="hidden" name="stkReqNo15" value="${fullForm.stkReqNo15}" id="stkReqNo15"></td>
					<td><input	type="hidden" name="confirmNo15" value="${fullForm.confirmNo15}" id="confirmNo15"></td>

				</tr>				
</c:if>																
			</tbody>
			<tfoot>

			</tfoot>						
		</table>
		</center><br></br>     	
		<font size='2'>หมายเหตุ : <font color="red">*</font> คือข้อมูลที่ต้องใส่</font>
     </fieldset>
 	</div>
 	
 	<table border="0" align="center" width="100%">
 		<tr>
 			<td align="center" ><html:submit value="บันทึกใบสั่งซื้อ PO" onclick="return confirm('ยืนยัน ?');" /></td>
 			<td align="center" ><html:reset value="เคลียร์หน้าบันทึก"/></td>
			<td align="center" ><html:button  value="กลับไปรายการเมนู" property="show1" 
 			onclick="gotoMenu()"  /></td> 			
 		</tr>
 	</table>    	    	    	
    </html:form><br>
    </div>

<script type="text/javascript">

var item2 = document.getElementById("item2").value;
var item3 = document.getElementById("item3").value;
var item4 = document.getElementById("item4").value;

	if(item2=="") {
		idArray[1] = 0;
	}
	if(item3=="") {
		idArray[2] = 0;
	}
	if(item4=="") {
		idArray[3] = 0;
	}	

function refreshForm() {
	var lAddr = document.getElementById("localAddr").value;
	var lPort = document.getElementById("localPort").value;
	var ctPath = document.getElementById("contextPath").value;
	var docNo = document.getElementById("docNo").value
	window.location = "http://"+lAddr+":"+lPort+ctPath+"/StkReq.do?mode=edit&docNo="+docNo;	
}
function gotoMenu() {
	var lAddr = document.getElementById("localAddr").value;
	var lPort = document.getElementById("localPort").value;
	var ctPath = document.getElementById("contextPath").value;
	window.location = "http://"+lAddr+":"+lPort+ctPath+"/Login.do?mode=check";
}
</script>
<input type="hidden" value="<%=request.getLocalAddr() %>" id="localAddr">
<input type="hidden" value="<%=request.getLocalPort() %>" id="localPort">
<input type="hidden" value="<%=request.getContextPath() %>" id="contextPath">

<!-- 
<a href="#" class="add"><img src="add.png" width="24" height="24" alt="add" title="add input" /></a> 
<a href="#" class="reset"><img src="reset.png" width="24" height="24" alt="reset" /></a>
 -->
 
</body>
</html:html>